 {
        
        var o = require("../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                seatId: 0,
                nodeHead: {
                    default: null,
                    type: cc.Node
                },
                labCoin: {
                    default: null,
                    type: cc.Label
                },
                interactionBarPre: {
                    default: null,
                    type: cc.Prefab
                },
                headAnimate: {
                    default: null,
                    type: cc.Node
                }
            },
            onLoad: function () {
                Global.notificationCenter.on(Global.eventName.GAME_UPDATE_SCORE, this._refresh.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_REWARD_INFO, this.setData.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_USER_ONLINE_INFO, this.showState.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_UPDATA_TIME_OUT, this.updateHeadEffect.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_TING, this.opearStateShow.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.MSG_STOP_HEAD_EFFECT, this.stopHeadEffect.bind(this), this),
                    this.labState = Global.utils.searchNode(this.node, "stateTips").getComponent(cc.Label),
                    this.spState = Global.utils.searchNode(this.node, "spStateTips").getComponent(cc.Sprite),
                    this.isInitHead = !1, Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERREN && Global.roomInfoModel.getPlayModel() != Global.config.playModel.ERRENQUICK || this.seatId != Global.config.SEAT_RIGHT && this.seatId != Global.config.SEAT_LEFT ? this.refresh() : this.node.active = !1;
            },
            opearStateShow: function (e) {
                e && ((Global.tableModel.toLocalSeatIndex(e.seatId) == this.seatId || e.isGameEnd) && (e.ting_result && e.ting_result.length > 0 ? (this.isTing = !0,
                    this.spState.node.active = !0, Global.spriteAtlas.setSpriteFrame(this.spState, "Texture/table", "tingpai")) : this.spState.node.active = !1));
            },
            updateHeadEffect: function (e) {
                this.headAnimate.active = !1, Global.tableModel.toLocalSeatIndex(e.curSeatId) != this.seatId || (this.headAnimate.active = !0);
            },
            stopHeadEffect: function () {
                this.headAnimate.active = !1;
            },
            showState: function (e) {
                if (e) for (var t = e.online_info, n = 0; n < t.length; n++) {
                    var o = t[n];
                    if (Global.tableModel.toLocalSeatIndex(o.seatId) == this.seatId) return void (0 == o.state ? (this.labState.node.active = !0,
                        this.labState.string = "已离线") : this.isTing || (this.labState.node.active = !1));
                }
            },
            setData: function (e) {
                if (this.seatId == Global.config.SEAT_DOWN) {
                    if ("recieve" == e.action) if (console.error("收到了救济金领取成功的消息，接下来再发充值成功消息 data ：", e),
                        e.tip) Global.utils.showNodeCommon(e.tip, 2); else {
                        this.recieveTableCoin = e.finalChip;
                        var t = function () {
                            if (this.recieveTableCoin ? this.labCoin.string = Global.utils.exchangeToWan(this.recieveTableCoin) : this.labCoin.string = "3000",
                                console.log("onBtnCharge ", Global.tableModel.getIsGameEnd()), Global.tableModel.isInGameScene()) if (Global.tableModel.getIsGameEnd()) {
                                var e = Global.roomInfoModel.getPlayModel(), t = Global.roomInfoModel.getRoomId();
                                Global.msgHandler.requestQuickStart(e, t);
                            } else {
                                var n = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                                n && Global.tableModel.requestCharge(1, n.getSeatId());
                            }
                        }.bind(this), n = {
                            reward: e.deltaChip,
                            name: "金币",
                            type: "freegive"
                        };
                        Global.UIPopupManager.addPopup("PopupPanel/Panel_shareGroup_Reward", function (e) {
                            e.getComponent("shareGroup_RewardPanel").setData(n, t), Global.spriteAtlas.setSpriteFrame(e.getComponent("shareGroup_RewardPanel").rewardSp, "Texture/Rewards", "WP_3");
                        });
                    }
                }
            },
            start: function () {
            },
            onDestroy: function () {
                Global.notificationCenter.offAll(this);
            },
            refresh: function () {
                var e = Global.tableModel.getPlayerModel(this.seatId);
                if (e) {
                    var t = e.getPic(), n = Global.tableModel.getTableType(),
                        o = n == Global.config.tableType.CREATE || n == Global.config.tableType.SCORE_TABLE ? e.getFriScore() : e.getTableCoin();
                    if (console.log("GameHeadController refresh tableCoin = ", this.seatId, o), !this.isInitHead) {
                        if (this.seatId == Global.config.SEAT_DOWN) Global.userProfile.setMyHeadSpf(this.nodeHead.getComponent("HeadController").spHead); else {
                            var i = this.nodeHead.getComponent("HeadController");
                            i && i.bindData(t);
                        }
                        this.isInitHead = !0;
                    }
                    this.labCoin.string = Global.utils.exchangeToWan(o);
                }
            },
            onHeadClick: function () {
                o.playEffect("select");
                var e = SceneHelper.getCurScene().getComponent("ChatInteractionController");
                e.onInteractionBarClickOther();
                var t = null, n = Global.tableModel.getPlayerModel(this.seatId);
                t = cc.instantiate(this.interactionBarPre), this.node.parent && this.node.parent.addChild(t),
                    t.setPosition([{
                        x: 250,
                        y: 217
                    }, {
                        x: -26,
                        y: 225
                    }, {
                        x: -263,
                        y: 44
                    }][this.seatId - 1]), t.getComponent("NodeInteractionController").setData({
                    seatId: this.seatId,
                    coin: null != n ? n.getTableCoin() : 0,
                    pic: null != n ? n.getPic() : "",
                    name: null != n ? n.getName() : "",
                    sex: null != n ? n.getSex() : 0
                }), e.setInteractionBar(t);
            },
            playInteractionAni: function (e, t, n) {
                this.node.addChild(e);
                var i = e.getComponent(cc.Animation);
                if (i) {
                    for (var a = i.getClips()[t]._name, r = 0; r < e.children.length; r++) if (e.children[r].name == a) {
                        e.children[r].active = !0;
                        break;
                    }
                    i.play(a), i.on("finished", function () {
                        i.scheduleOnce(function () {
                            cc.isValid(e) && e.destroy();
                        }, .4);
                    }, this);
                }
                o.playEmojiChat(n);
            },
            _refresh: function () {
                this.refresh();
            }
        })
    }